package com.mygo.designPattern.behavioral.chainOfResponsibilityPattern;

public class LeaveApprovalSystem {
    public static void main(String[] args) {
        // 创建审批者
        Approver teamLeader = new TeamLeader();
        Approver manager = new Manager();
        Approver director = new Director();

        // 设置责任链
        teamLeader.setNextApprover(manager);
        manager.setNextApprover(director);

        // 创建请假请求
        LeaveRequest request1 = new LeaveRequest("张三", 2);
        LeaveRequest request2 = new LeaveRequest("李四", 5);
        LeaveRequest request3 = new LeaveRequest("王五", 12);
        LeaveRequest request4 = new LeaveRequest("赵六", 20);

        // 处理请求
        teamLeader.processRequest(request1);
        teamLeader.processRequest(request2);
        teamLeader.processRequest(request3);
        teamLeader.processRequest(request4);
    }
}